Lego Sherlock Holmes figure focuses a light beam on a Lego criminal with a small magnifying glass.

The LEGO Bitcoin Analyst

The LEGO bitcoin analyst

Recognizing that I have an odd sense of humor that might be hard to follow, let me begin with a DISCLAIMER. While the project described here does work in the engineering sense, it does not work in the financial cents. This project is SATIRE. Bitcoin offers much to be satirized: ridiculous overvaluation, insane speculation, crazed volatility, and egregious manipulation. I suspect that whoever invented bitcoin meant for it partly to be a satire of fiat currency and modern economic theory. So let's pile satire atop satire ...



Raspberry Pi linked to MINDSTORMS EV3


Extending the idea of my prior post on "Internet of LEGO Things", here's an invention, pictured above, that constantly monitors the price of bitcoin to give a buy/sell recommendation every 5 minutes. The current price of bitcoin and the change over the past 5 minutes are displayed on the front panel of the EV3 brick (pictured at the top of the page). A change in price is announced by a motorized robot bird flapping its wings to get your attention. Then the EV3 brick will announce by a speech syntesizer to either buy or sell. I adapted the flapping mechanism from Yoshihito Isogawa's book "The LEGO MINDSTORMS EV3 Idea Book". We're assuming here the strategy of "buy low, sell high", so when the price drops it's time to buy. Videos of the action are below.











The hardware involved includes a Raspberry Pi (in a Pi-Blox case in the photos and video above). The Raspberry Pi is programmed to scrape a website for a rapid update on bitcoin price. I made the website using ThingSpeak (www.thingspeak.com), as in the screenshot below, which creates a web address that has nothing on it except for the current price of bitcoin.



ThingSpeak page to find bitcoin price




I wrote a Python program, in the screenshot below, to query the ThingSpeak-generated webpage, then pass the bitcoin data over UART to the EV3 brick. Another Python program on the EV3 brick, at the bottom of the screen, displays the bitcoin price and generates motion, lighting, and speech based on changes in bitcoin price. This program uses many of the interesting developments at Pybricks (www.pybricks.com). There's a bit of complexity in the program to change the byte data format passed by UART to a numerical format for calculations.



Raspberry Pi program to query ThingSpeak webpage



EV3 program to take action based on bitcoin price